package com.dc.util;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CommonCodeUtil {

    @Autowired
    private static RedisUtil redisUtil;

    @Autowired
    public void setRedisService(RedisUtil redisService) {
        CommonCodeUtil.redisUtil = redisService;
    }

    public static boolean increasing(String name) {
        if (redisUtil.hasKey(name)) {
            redisUtil.increasing(name, 1);
            return true;
        }
        return false;
    }


    public static boolean test(String name, Double ddd) {
        if (redisUtil.hasKey(name)) {
            Double aDouble = redisUtil.increasingDouble(name, ddd);
            return true;
        }
        return false;
    }


}
